package com.cvit.controller;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.cvit.service.LoginService;

@Controller
public class LoginController {

	@Autowired
	LoginService loginService;
	
	/**
	 * @author WYHY
	 * @param managername 用户名 passwoed 密码
	 * */
	@RequestMapping("/login")
	@ResponseBody
	public Map login(@RequestParam(value="managerName")String managerName,@RequestParam(value="password")String password) {
		Map map=new HashMap<>();
		map=loginService.login(managerName, password);
		return map;
	}
	
	/**
	 * @author WYHY
	 * @param 获取服务器时间
	 * */
	@RequestMapping("/backTime")
	@ResponseBody
	public String getTime() {
		SimpleDateFormat format=new SimpleDateFormat("YYYY-MM-dd");
		Date date=new Date();
		String time=format.format(date);
		System.out.println(time);
		return time;
	}
	
}
